package com.wms.shop.controller;

import com.wms.common.core.domain.R;
import com.wms.common.core.web.controller.BaseController;
import com.wms.common.core.web.domain.AjaxResult;
import com.wms.oms.api.RemoteProductCategoryService;
import com.wms.shop.domain.Banner;
import com.wms.shop.service.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商城首页ontroller
 *
 * @author zzm
 * @date 2021-08-18
 */
@RestController
@RequestMapping("/wx/index")
public class WxIndexController extends BaseController {


    @Autowired
    private IBannerService bannerService;

    @Autowired
    private RemoteProductCategoryService remoteProductCategoryService;

    /**
     * 查询首页banner图列表
     */
    @GetMapping("/banners")
    public AjaxResult banners(Banner banner)
    {
        List<Banner> list = bannerService.selectBannerList(banner);
        return AjaxResult.success(list);
    }

    @GetMapping("/categoryList")
    public R categoryList(){
        R<List> result = remoteProductCategoryService.getProductCategoryList();
       return result;
    }

}
